package com.jl.smartcard.ui.editors.scr;

import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.IDocumentProvider;

import com.jl.card.tracer.IAppendAble;

public class ScrEditor extends TextEditor implements IAppendAble {

	public static final String ID = "com.jl.smartcard.ui.editors.ScrEditor"; //$NON-NLS-1$
	
	//private ISCRTracer tracer = null;
	
	public ScrEditor() {
		super();
		//this.tracer = new EditorTracer(this);
	}

	@Override
	public void close(boolean save) {
		super.close(save);
	}

	@Override
	public void append(String str) {
		IDocumentProvider docp = this.getDocumentProvider();
		if (docp == null) {
			return;
		}
		IDocument doc = docp.getDocument(this.getEditorInput());
		try {
			doc.replace(doc.getLength(), 0, str);
		} catch (BadLocationException e) {
			e.printStackTrace();
		}
	}
}
